import 'package:flutter/material.dart';
import 'package:whale/pages/means/model/means_model.dart';

import '../../../../helper/utils/util.dart';
import '../index.dart';

/// hello
class MeansCell extends GetView<MeansController> {
  const MeansCell({
    Key? key,
    required this.md,
  }) : super(key: key);
  final MeansModel md;
  @override
  Widget build(BuildContext context) {
    var riskColors = md.riskColors;
    return InkWell(
      onTap: () {
        Get.toNamed(RouterPath.means_detail, arguments: md);
      },
      child: Container(
        padding: EdgeInsets.symmetric(
          horizontal: 12.r,
          vertical: 12.r,
        ),
        color: Colors.white,
        child: Row(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Visibility(
              visible: md.reportType == '政策措施' || md.reportType == '招标采购',
              child: Row(
                children: [
                  Container(
                    // padding: EdgeInsets.symmetric(horizontal: 8.r),
                    height: 20.r,
                    width: 50.r,
                    alignment: Alignment.center,
                    decoration: BoxDecoration(
                        color: riskColors.last,
                        borderRadius: BorderRadius.circular(2)),
                    child: Text(
                      md.riskLevel ?? '',
                      style: TextStyle(
                        color: riskColors.first,
                        fontSize: 10.sp,
                      ),
                    ),
                  ),
                  SizedBox(
                    width: 8.r,
                  ),
                ],
              ),
            ),
            Expanded(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    md.documentTitle ?? '',
                    style: TextStyle(
                      color: ColorsUtil.title,
                      fontSize: 14.sp,
                    ),
                  ),
                  Visibility(
                      visible: !isNilStr(md.publishTime),
                      child: Column(
                        children: [
                          SizedBox(
                            height: 14.r,
                          ),
                          Row(
                            // mainAxisAlignment: Main,
                            children: [
                              Text(
                                md.publishTime?.split(' ').first ?? '',
                                style: TextStyle(
                                  color: ColorsUtil.content,
                                  fontSize: 12.sp,
                                ),
                              ),
                              SizedBox(
                                width: 10.r,
                              ),
                            ],
                          ),
                        ],
                      ))
                ],
              ),
            ),
            Icon(
              IconUtil.arrow_right,
              color: const Color(0xffA0A0A0),
              size: 13.r,
            ),
          ],
        ),
      ),
    );
  }
}
